home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / binutils.7 / binutils / binutils-2.7 / gas / m68k-parse.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-15  |  50.4 KB  |  1,977 lines

  1.  
  2. /*  A Bison parser, made from ./config/m68k-parse.y with Bison version GNU Bison version 1.24
  3.   */
  4.  
  5. #define YYBISON 1  /* Identify Bison output.  */
  6.  
  7. #define    DR    258
  8. #define    AR    259
  9. #define    FPR    260
  10. #define    FPCR    261
  11. #define    LPC    262
  12. #define    ZAR    263
  13. #define    ZDR    264
  14. #define    LZPC    265
  15. #define    CREG    266
  16. #define    INDEXREG    267
  17. #define    EXPR    268
  18.  
  19. #line 27 "./config/m68k-parse.y"
  20.  
  21.  
  22. #include "as.h"
  23. #include "tc-m68k.h"
  24. #include "m68k-parse.h"
  25.  
  26. /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
  27.    etc), as well as gratuitiously global symbol names If other parser
  28.    generators (bison, byacc, etc) produce additional global names that
  29.    conflict at link time, then those parser generators need to be
  30.    fixed instead of adding those names to this list. */
  31.  
  32. #define    yymaxdepth m68k_maxdepth
  33. #define    yyparse    m68k_parse
  34. #define    yylex    m68k_lex
  35. #define    yyerror    m68k_error
  36. #define    yylval    m68k_lval
  37. #define    yychar    m68k_char
  38. #define    yydebug    m68k_debug
  39. #define    yypact    m68k_pact    
  40. #define    yyr1    m68k_r1            
  41. #define    yyr2    m68k_r2            
  42. #define    yydef    m68k_def        
  43. #define    yychk    m68k_chk        
  44. #define    yypgo    m68k_pgo        
  45. #define    yyact    m68k_act        
  46. #define    yyexca    m68k_exca
  47. #define yyerrflag m68k_errflag
  48. #define yynerrs    m68k_nerrs
  49. #define    yyps    m68k_ps
  50. #define    yypv    m68k_pv
  51. #define    yys    m68k_s
  52. #define    yy_yys    m68k_yys
  53. #define    yystate    m68k_state
  54. #define    yytmp    m68k_tmp
  55. #define    yyv    m68k_v
  56. #define    yy_yyv    m68k_yyv
  57. #define    yyval    m68k_val
  58. #define    yylloc    m68k_lloc
  59. #define yyreds    m68k_reds        /* With YYDEBUG defined */
  60. #define yytoks    m68k_toks        /* With YYDEBUG defined */
  61. #define yylhs    m68k_yylhs
  62. #define yylen    m68k_yylen
  63. #define yydefred m68k_yydefred
  64. #define yydgoto    m68k_yydgoto
  65. #define yysindex m68k_yysindex
  66. #define yyrindex m68k_yyrindex
  67. #define yygindex m68k_yygindex
  68. #define yytable     m68k_yytable
  69. #define yycheck     m68k_yycheck
  70.  
  71. #ifndef YYDEBUG
  72. #define YYDEBUG 1
  73. #endif
  74.  
  75. /* Internal functions.  */
  76.  
  77. static enum m68k_register m68k_reg_parse PARAMS ((char **));
  78. static int yylex PARAMS (());
  79. static void yyerror PARAMS ((const char *));
  80.  
  81. /* The parser sets fields pointed to by this global variable.  */
  82. static struct m68k_op *op;
  83.  
  84.  
  85. #line 93 "./config/m68k-parse.y"
  86. typedef union
  87. {
  88.   struct m68k_indexreg indexreg;
  89.   enum m68k_register reg;
  90.   struct m68k_exp exp;
  91.   unsigned long mask;
  92.   int onereg;
  93. } YYSTYPE;
  94.  
  95. #ifndef YYLTYPE
  96. typedef
  97.   struct yyltype
  98.     {
  99.       int timestamp;
  100.       int first_line;
  101.       int first_column;
  102.       int last_line;
  103.       int last_column;
  104.       char *text;
  105.    }
  106.   yyltype;
  107.  
  108. #define YYLTYPE yyltype
  109. #endif
  110.  
  111. #include <stdio.h>
  112.  
  113. #ifndef __cplusplus
  114. #ifndef __STDC__
  115. #define const
  116. #endif
  117. #endif
  118.  
  119.  
  120.  
  121. #define    YYFINAL        170
  122. #define    YYFLAG        -32768
  123. #define    YYNTBASE    25
  124.  
  125. #define YYTRANSLATE(x) ((unsigned)(x) <= 268 ? yytranslate[x] : 44)
  126.  
  127. static const char yytranslate[] = {     0,
  128.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  129.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  130.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  131.      2,     2,     2,     2,    14,     2,     2,    15,     2,    16,
  132.     17,     2,    18,    20,    19,     2,    24,     2,     2,     2,
  133.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  134.      2,     2,     2,    23,     2,     2,     2,     2,     2,     2,
  135.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  136.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  137.     21,     2,    22,     2,     2,     2,     2,     2,     2,     2,
  138.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  139.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  140.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  141.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  142.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  143.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  144.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  145.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  146.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  147.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  148.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  149.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  150.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  151.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  152.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  153.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  154.      6,     7,     8,     9,    10,    11,    12,    13
  155. };
  156.  
  157. #if YYDEBUG != 0
  158. static const short yyprhs[] = {     0,
  159.      0,     2,     4,     6,     8,    10,    12,    14,    16,    18,
  160.     21,    24,    26,    30,    35,    40,    46,    52,    57,    61,
  161.     65,    69,    77,    85,    92,    99,   105,   112,   118,   124,
  162.    129,   139,   147,   156,   163,   174,   183,   194,   203,   212,
  163.    215,   219,   223,   229,   236,   247,   257,   268,   270,   272,
  164.    274,   276,   278,   280,   282,   284,   286,   288,   290,   292,
  165.    294,   296,   297,   299,   301,   303,   304,   307,   308,   311,
  166.    312,   315,   317,   321,   325,   327,   329,   333,   337,   341,
  167.    343,   345,   347
  168. };
  169.  
  170. static const short yyrhs[] = {    26,
  171.      0,    27,     0,    28,     0,     3,     0,     4,     0,     5,
  172.      0,     6,     0,    11,     0,    13,     0,    14,    13,     0,
  173.     15,    13,     0,    40,     0,    16,     4,    17,     0,    16,
  174.      4,    17,    18,     0,    19,    16,     4,    17,     0,    16,
  175.     13,    20,    34,    17,     0,    16,    34,    20,    13,    17,
  176.      0,    13,    16,    34,    17,     0,    16,     7,    17,     0,
  177.     16,     8,    17,     0,    16,    10,    17,     0,    16,    13,
  178.     20,    34,    20,    29,    17,     0,    16,    13,    20,    34,
  179.     20,    36,    17,     0,    16,    13,    20,    30,    37,    17,
  180.      0,    13,    16,    34,    20,    29,    17,     0,    16,    34,
  181.     20,    29,    17,     0,    13,    16,    34,    20,    36,    17,
  182.      0,    16,    34,    20,    36,    17,     0,    13,    16,    30,
  183.     37,    17,     0,    16,    30,    37,    17,     0,    16,    21,
  184.     13,    37,    22,    20,    29,    38,    17,     0,    16,    21,
  185.     13,    37,    22,    38,    17,     0,    16,    21,    34,    22,
  186.     20,    29,    38,    17,     0,    16,    21,    34,    22,    38,
  187.     17,     0,    16,    21,    13,    20,    34,    20,    29,    22,
  188.     38,    17,     0,    16,    21,    34,    20,    29,    22,    38,
  189.     17,     0,    16,    21,    13,    20,    34,    20,    36,    22,
  190.     38,    17,     0,    16,    21,    34,    20,    36,    22,    38,
  191.     17,     0,    16,    21,    39,    30,    37,    22,    38,    17,
  192.      0,    35,    23,     0,    35,    23,    18,     0,    35,    23,
  193.     19,     0,    35,    23,    16,    13,    17,     0,    35,    23,
  194.     16,    39,    29,    17,     0,    35,    23,    16,    13,    17,
  195.     23,    16,    39,    29,    17,     0,    35,    23,    16,    13,
  196.     17,    23,    16,    13,    17,     0,    35,    23,    16,    39,
  197.     29,    17,    23,    16,    13,    17,     0,    12,     0,    31,
  198.      0,    12,     0,    32,     0,    32,     0,     4,     0,     8,
  199.      0,     3,     0,     9,     0,     4,     0,     7,     0,    33,
  200.      0,    10,     0,     8,     0,     0,    34,     0,     7,     0,
  201.     10,     0,     0,    20,    34,     0,     0,    20,    13,     0,
  202.      0,    13,    20,     0,    42,     0,    42,    24,    41,     0,
  203.     43,    24,    41,     0,    43,     0,    42,     0,    42,    24,
  204.     41,     0,    43,    24,    41,     0,    43,    19,    43,     0,
  205.      3,     0,     4,     0,     5,     0,     6,     0
  206. };
  207.  
  208. #endif
  209.  
  210. #if YYDEBUG != 0
  211. static const short yyrline[] = { 0,
  212.    116,   118,   119,   124,   130,   135,   140,   145,   150,   155,
  213.    160,   165,   177,   183,   188,   193,   203,   213,   223,   228,
  214.    233,   238,   245,   256,   263,   270,   276,   287,   297,   304,
  215.    310,   318,   325,   332,   338,   346,   353,   365,   376,   388,
  216.    397,   405,   413,   423,   430,   438,   445,   458,   460,   472,
  217.    474,   485,   487,   488,   493,   495,   500,   502,   508,   510,
  218.    511,   516,   521,   526,   528,   533,   538,   546,   552,   560,
  219.    566,   574,   576,   580,   591,   596,   597,   601,   607,   614,
  220.    619,   623,   627
  221. };
  222.  
  223. static const char * const yytname[] = {   "$","error","$undefined.","DR","AR",
  224. "FPR","FPCR","LPC","ZAR","ZDR","LZPC","CREG","INDEXREG","EXPR","'#'","'&'","'('",
  225. "')'","'+'","'-'","','","'['","']'","'@'","'/'","operand","generic_operand",
  226. "motorola_operand","mit_operand","zireg","zdireg","zadr","zdr","apc","zapc",
  227. "optzapc","zpc","optczapc","optcexpr","optexprc","reglist","ireglist","reglistpair",
  228. "reglistreg",""
  229. };
  230. #endif
  231.  
  232. static const short yyr1[] = {     0,
  233.     25,    25,    25,    26,    26,    26,    26,    26,    26,    26,
  234.     26,    26,    27,    27,    27,    27,    27,    27,    27,    27,
  235.     27,    27,    27,    27,    27,    27,    27,    27,    27,    27,
  236.     27,    27,    27,    27,    27,    27,    27,    27,    27,    28,
  237.     28,    28,    28,    28,    28,    28,    28,    29,    29,    30,
  238.     30,    31,    31,    31,    32,    32,    33,    33,    34,    34,
  239.     34,    35,    35,    36,    36,    37,    37,    38,    38,    39,
  240.     39,    40,    40,    40,    41,    41,    41,    41,    42,    43,
  241.     43,    43,    43
  242. };
  243.  
  244. static const short yyr2[] = {     0,
  245.      1,     1,     1,     1,     1,     1,     1,     1,     1,     2,
  246.      2,     1,     3,     4,     4,     5,     5,     4,     3,     3,
  247.      3,     7,     7,     6,     6,     5,     6,     5,     5,     4,
  248.      9,     7,     8,     6,    10,     8,    10,     8,     8,     2,
  249.      3,     3,     5,     6,    10,     9,    10,     1,     1,     1,
  250.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  251.      1,     0,     1,     1,     1,     0,     2,     0,     2,     0,
  252.      2,     1,     3,     3,     1,     1,     3,     3,     3,     1,
  253.      1,     1,     1
  254. };
  255.  
  256. static const short yydefact[] = {    62,
  257.     80,    81,    82,    83,    58,    61,    60,     8,     9,     0,
  258.      0,     0,     0,     1,     2,     3,    59,    63,     0,    12,
  259.     72,     0,     0,    10,    11,    55,    57,    58,    61,    56,
  260.     60,    50,     0,    70,    66,    51,     0,     0,    40,     0,
  261.      0,     0,    57,    66,     0,    13,    19,    20,    21,     0,
  262.     66,     0,     0,     0,     0,     0,     0,    70,    41,    42,
  263.     80,    81,    82,    83,    73,    76,    75,    79,    74,     0,
  264.     18,     0,    14,    66,     0,    71,     0,     0,    68,    66,
  265.     67,    30,    53,    64,    54,    65,    48,     0,     0,    49,
  266.     52,     0,    15,     0,     0,     0,     0,    29,     0,     0,
  267.      0,    16,     0,    67,    68,     0,     0,     0,     0,     0,
  268.     17,    26,    28,    43,    71,     0,    77,    78,    25,    27,
  269.     24,     0,     0,     0,     0,     0,    68,    68,    69,    68,
  270.     34,    68,     0,    44,    22,    23,     0,     0,    68,    32,
  271.      0,     0,     0,     0,     0,    70,     0,    68,    68,     0,
  272.     36,    38,    33,    39,     0,     0,     0,     0,     0,    31,
  273.     46,     0,     0,    35,    37,    45,    47,     0,     0,     0
  274. };
  275.  
  276. static const short yydefgoto[] = {   168,
  277.     14,    15,    16,    89,    35,    90,    91,    17,    18,    19,
  278.     92,    55,   109,    53,    20,    65,    66,    67
  279. };
  280.  
  281. static const short yypact[] = {    68,
  282.     19,    10,    34,    39,-32768,-32768,-32768,-32768,    -5,    31,
  283.     38,    56,    46,-32768,-32768,-32768,-32768,-32768,    47,-32768,
  284.     62,    -2,   104,-32768,-32768,-32768,    63,    74,    75,-32768,
  285.     80,-32768,    82,   121,    83,-32768,    84,   111,   131,   140,
  286.    140,   140,-32768,    83,     3,   101,-32768,-32768,-32768,   104,
  287.    100,    30,     9,   132,   118,    86,   136,   143,-32768,-32768,
  288. -32768,-32768,-32768,-32768,-32768,   124,    11,-32768,-32768,   141,
  289. -32768,   114,-32768,    83,   110,   132,   137,   114,   142,    83,
  290. -32768,-32768,-32768,-32768,-32768,-32768,-32768,   144,   146,-32768,
  291. -32768,   147,-32768,   134,   129,   140,   140,-32768,   148,   149,
  292.    150,-32768,   114,   151,   152,   138,   153,    97,   156,   154,
  293. -32768,-32768,-32768,   145,-32768,   157,-32768,-32768,-32768,-32768,
  294. -32768,   160,   161,   114,    97,   162,   163,   163,-32768,   163,
  295. -32768,   163,   164,   158,-32768,-32768,   165,   166,   163,-32768,
  296.    169,   167,   168,   172,   173,   178,   170,   163,   163,   175,
  297. -32768,-32768,-32768,-32768,   135,   129,   180,   177,   179,-32768,
  298. -32768,   181,   182,-32768,-32768,-32768,-32768,   195,   197,-32768
  299. };
  300.  
  301. static const short yypgoto[] = {-32768,
  302. -32768,-32768,-32768,   -71,     5,-32768,    -7,-32768,    -9,-32768,
  303.    -63,   -38,  -101,   -58,-32768,   -40,   200,     8
  304. };
  305.  
  306.  
  307. #define    YYLAST        200
  308.  
  309.  
  310. static const short yytable[] = {    95,
  311.     99,    69,    37,   126,    36,    70,   106,    22,   100,    -5,
  312.     23,    26,    77,    45,   107,    36,    41,    30,    -4,    71,
  313.     32,    42,    72,   116,    52,   142,   143,    44,   144,    41,
  314.    145,   122,   -57,    -6,    97,   101,   130,   150,    -7,   123,
  315.     75,   110,    36,    24,    81,    36,   158,   159,    68,    78,
  316.     25,    79,   137,   139,    74,   117,   118,    80,    26,    27,
  317.    138,    38,    28,    29,    30,    31,   104,    32,    33,    39,
  318.      1,     2,     3,     4,     5,     6,    34,     7,     8,    46,
  319.      9,    10,    11,    12,   162,    40,    13,   156,    26,    83,
  320.     47,    48,    84,    85,    30,    86,    49,    87,    88,    26,
  321.     83,    50,    54,    56,    85,    30,    26,    43,    87,   129,
  322.      5,     6,    30,     7,    57,    32,    26,    83,    73,    76,
  323.     84,    85,    30,    86,    43,    87,   102,     5,     6,   103,
  324.      7,    26,    83,    51,    82,    43,    85,    30,     5,     6,
  325.     87,     7,    61,    62,    63,    64,    58,    96,    59,    60,
  326.    114,   161,    93,   115,   115,    94,     0,    98,   105,   127,
  327.    111,   108,   112,   113,   119,   120,   121,   133,     0,     0,
  328.    124,   125,   131,   134,   128,   132,   135,   136,   140,   146,
  329.    147,   129,   141,   151,   152,   157,   148,   149,   153,   154,
  330.    155,   160,   163,   164,   169,   165,   170,   166,   167,    21
  331. };
  332.  
  333. static const short yycheck[] = {    58,
  334.     72,    42,    12,   105,    12,    44,    78,     0,    72,     0,
  335.     16,     3,    51,    23,    78,    23,    19,     9,     0,    17,
  336.     12,    24,    20,    95,    34,   127,   128,    23,   130,    19,
  337.    132,   103,    23,     0,    24,    74,   108,   139,     0,   103,
  338.     50,    80,    50,    13,    54,    53,   148,   149,    41,    20,
  339.     13,    22,   124,   125,    50,    96,    97,    53,     3,     4,
  340.    124,    16,     7,     8,     9,    10,    76,    12,    13,    23,
  341.      3,     4,     5,     6,     7,     8,    21,    10,    11,    17,
  342.     13,    14,    15,    16,   156,    24,    19,   146,     3,     4,
  343.     17,    17,     7,     8,     9,    10,    17,    12,    13,     3,
  344.      4,    20,    20,    20,     8,     9,     3,     4,    12,    13,
  345.      7,     8,     9,    10,     4,    12,     3,     4,    18,    20,
  346.      7,     8,     9,    10,     4,    12,    17,     7,     8,    20,
  347.     10,     3,     4,    13,    17,     4,     8,     9,     7,     8,
  348.     12,    10,     3,     4,     5,     6,    16,    24,    18,    19,
  349.     17,    17,    17,    20,    20,    13,    -1,    17,    22,    22,
  350.     17,    20,    17,    17,    17,    17,    17,    23,    -1,    -1,
  351.     20,    20,    17,    17,    22,    22,    17,    17,    17,    16,
  352.     23,    13,    20,    17,    17,    16,    22,    22,    17,    17,
  353.     13,    17,    13,    17,     0,    17,     0,    17,    17,     0
  354. };
  355. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  356. #line 3 "/usr/unsupported/share/bison.simple"
  357.  
  358. /* Skeleton output parser for bison,
  359.    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
  360.  
  361.    This program is free software; you can redistribute it and/or modify
  362.    it under the terms of the GNU General Public License as published by
  363.    the Free Software Foundation; either version 2, or (at your option)
  364.    any later version.
  365.  
  366.    This program is distributed in the hope that it will be useful,
  367.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  368.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  369.    GNU General Public License for more details.
  370.  
  371.    You should have received a copy of the GNU General Public License
  372.    along with this program; if not, write to the Free Software
  373.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  374.  
  375. /* As a special exception, when this file is copied by Bison into a
  376.    Bison output file, you may use that output file without restriction.
  377.    This special exception was added by the Free Software Foundation
  378.    in version 1.24 of Bison.  */
  379.  
  380. #ifndef alloca
  381. #ifdef __GNUC__
  382. #define alloca __builtin_alloca
  383. #else /* not GNU C.  */
  384. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
  385. #include <alloca.h>
  386. #else /* not sparc */
  387. #if defined (MSDOS) && !defined (__TURBOC__)
  388. #include <malloc.h>
  389. #else /* not MSDOS, or __TURBOC__ */
  390. #if defined(_AIX)
  391. #include <malloc.h>
  392.  #pragma alloca
  393. #else /* not MSDOS, __TURBOC__, or _AIX */
  394. #ifdef __hpux
  395. #ifdef __cplusplus
  396. extern "C" {
  397. void *alloca (unsigned int);
  398. };
  399. #else /* not __cplusplus */
  400. void *alloca ();
  401. #endif /* not __cplusplus */
  402. #endif /* __hpux */
  403. #endif /* not _AIX */
  404. #endif /* not MSDOS, or __TURBOC__ */
  405. #endif /* not sparc.  */
  406. #endif /* not GNU C.  */
  407. #endif /* alloca not defined.  */
  408.  
  409. /* This is the parser code that is written into each bison parser
  410.   when the %semantic_parser declaration is not specified in the grammar.
  411.   It was written by Richard Stallman by simplifying the hairy parser
  412.   used when %semantic_parser is specified.  */
  413.  
  414. /* Note: there must be only one dollar sign in this file.
  415.    It is replaced by the list of actions, each action
  416.    as one case of the switch.  */
  417.  
  418. #define yyerrok        (yyerrstatus = 0)
  419. #define yyclearin    (yychar = YYEMPTY)
  420. #define YYEMPTY        -2
  421. #define YYEOF        0
  422. #define YYACCEPT    return(0)
  423. #define YYABORT     return(1)
  424. #define YYERROR        goto yyerrlab1
  425. /* Like YYERROR except do call yyerror.
  426.    This remains here temporarily to ease the
  427.    transition to the new meaning of YYERROR, for GCC.
  428.    Once GCC version 2 has supplanted version 1, this can go.  */
  429. #define YYFAIL        goto yyerrlab
  430. #define YYRECOVERING()  (!!yyerrstatus)
  431. #define YYBACKUP(token, value) \
  432. do                                \
  433.   if (yychar == YYEMPTY && yylen == 1)                \
  434.     { yychar = (token), yylval = (value);            \
  435.       yychar1 = YYTRANSLATE (yychar);                \
  436.       YYPOPSTACK;                        \
  437.       goto yybackup;                        \
  438.     }                                \
  439.   else                                \
  440.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  441. while (0)
  442.  
  443. #define YYTERROR    1
  444. #define YYERRCODE    256
  445.  
  446. #ifndef YYPURE
  447. #define YYLEX        yylex()
  448. #endif
  449.  
  450. #ifdef YYPURE
  451. #ifdef YYLSP_NEEDED
  452. #ifdef YYLEX_PARAM
  453. #define YYLEX        yylex(&yylval, &yylloc, YYLEX_PARAM)
  454. #else
  455. #define YYLEX        yylex(&yylval, &yylloc)
  456. #endif
  457. #else /* not YYLSP_NEEDED */
  458. #ifdef YYLEX_PARAM
  459. #define YYLEX        yylex(&yylval, YYLEX_PARAM)
  460. #else
  461. #define YYLEX        yylex(&yylval)
  462. #endif
  463. #endif /* not YYLSP_NEEDED */
  464. #endif
  465.  
  466. /* If nonreentrant, generate the variables here */
  467.  
  468. #ifndef YYPURE
  469.  
  470. int    yychar;            /*  the lookahead symbol        */
  471. YYSTYPE    yylval;            /*  the semantic value of the        */
  472.                 /*  lookahead symbol            */
  473.  
  474. #ifdef YYLSP_NEEDED
  475. YYLTYPE yylloc;            /*  location data for the lookahead    */
  476.                 /*  symbol                */
  477. #endif
  478.  
  479. int yynerrs;            /*  number of parse errors so far       */
  480. #endif  /* not YYPURE */
  481.  
  482. #if YYDEBUG != 0
  483. int yydebug;            /*  nonzero means print parse trace    */
  484. /* Since this is uninitialized, it does not stop multiple parsers
  485.    from coexisting.  */
  486. #endif
  487.  
  488. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  489.  
  490. #ifndef    YYINITDEPTH
  491. #define YYINITDEPTH 200
  492. #endif
  493.  
  494. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  495.     (effective only if the built-in stack extension method is used).  */
  496.  
  497. #if YYMAXDEPTH == 0
  498. #undef YYMAXDEPTH
  499. #endif
  500.  
  501. #ifndef YYMAXDEPTH
  502. #define YYMAXDEPTH 10000
  503. #endif
  504.  
  505. /* Prevent warning if -Wstrict-prototypes.  */
  506. #ifdef __GNUC__
  507. int yyparse (void);
  508. #endif
  509.  
  510. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  511. #define __yy_memcpy(FROM,TO,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  512. #else                /* not GNU C or C++ */
  513. #ifndef __cplusplus
  514.  
  515. /* This is the most reliable way to avoid incompatibilities
  516.    in available built-in functions on various systems.  */
  517. static void
  518. __yy_memcpy (from, to, count)
  519.      char *from;
  520.      char *to;
  521.      int count;
  522. {
  523.   register char *f = from;
  524.   register char *t = to;
  525.   register int i = count;
  526.  
  527.   while (i-- > 0)
  528.     *t++ = *f++;
  529. }
  530.  
  531. #else /* __cplusplus */
  532.  
  533. /* This is the most reliable way to avoid incompatibilities
  534.    in available built-in functions on various systems.  */
  535. static void
  536. __yy_memcpy (char *from, char *to, int count)
  537. {
  538.   register char *f = from;
  539.   register char *t = to;
  540.   register int i = count;
  541.  
  542.   while (i-- > 0)
  543.     *t++ = *f++;
  544. }
  545.  
  546. #endif
  547. #endif
  548.  
  549. #line 192 "/usr/unsupported/share/bison.simple"
  550.  
  551. /* The user can define YYPARSE_PARAM as the name of an argument to be passed
  552.    into yyparse.  The argument should have type void *.
  553.    It should actually point to an object.
  554.    Grammar actions can access the variable by casting it
  555.    to the proper pointer type.  */
  556.  
  557. #ifdef YYPARSE_PARAM
  558. #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
  559. #else
  560. #define YYPARSE_PARAM
  561. #define YYPARSE_PARAM_DECL
  562. #endif
  563.  
  564. int
  565. yyparse(YYPARSE_PARAM)
  566.      YYPARSE_PARAM_DECL
  567. {
  568.   register int yystate;
  569.   register int yyn;
  570.   register short *yyssp;
  571.   register YYSTYPE *yyvsp;
  572.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  573.   int yychar1 = 0;        /*  lookahead token as an internal (translated) token number */
  574.  
  575.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  576.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  577.  
  578.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  579.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  580.  
  581. #ifdef YYLSP_NEEDED
  582.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  583.   YYLTYPE *yyls = yylsa;
  584.   YYLTYPE *yylsp;
  585.  
  586. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  587. #else
  588. #define YYPOPSTACK   (yyvsp--, yyssp--)
  589. #endif
  590.  
  591.   int yystacksize = YYINITDEPTH;
  592.  
  593. #ifdef YYPURE
  594.   int yychar;
  595.   YYSTYPE yylval;
  596.   int yynerrs;
  597. #ifdef YYLSP_NEEDED
  598.   YYLTYPE yylloc;
  599. #endif
  600. #endif
  601.  
  602.   YYSTYPE yyval;        /*  the variable used to return        */
  603.                 /*  semantic values from the action    */
  604.                 /*  routines                */
  605.  
  606.   int yylen;
  607.  
  608. #if YYDEBUG != 0
  609.   if (yydebug)
  610.     fprintf(stderr, "Starting parse\n");
  611. #endif
  612.  
  613.   yystate = 0;
  614.   yyerrstatus = 0;
  615.   yynerrs = 0;
  616.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  617.  
  618.   /* Initialize stack pointers.
  619.      Waste one element of value and location stack
  620.      so that they stay on the same level as the state stack.
  621.      The wasted elements are never initialized.  */
  622.  
  623.   yyssp = yyss - 1;
  624.   yyvsp = yyvs;
  625. #ifdef YYLSP_NEEDED
  626.   yylsp = yyls;
  627. #endif
  628.  
  629. /* Push a new state, which is found in  yystate  .  */
  630. /* In all cases, when you get here, the value and location stacks
  631.    have just been pushed. so pushing a state here evens the stacks.  */
  632. yynewstate:
  633.  
  634.   *++yyssp = yystate;
  635.  
  636.   if (yyssp >= yyss + yystacksize - 1)
  637.     {
  638.       /* Give user a chance to reallocate the stack */
  639.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  640.       YYSTYPE *yyvs1 = yyvs;
  641.       short *yyss1 = yyss;
  642. #ifdef YYLSP_NEEDED
  643.       YYLTYPE *yyls1 = yyls;
  644. #endif
  645.  
  646.       /* Get the current used size of the three stacks, in elements.  */
  647.       int size = yyssp - yyss + 1;
  648.  
  649. #ifdef yyoverflow
  650.       /* Each stack pointer address is followed by the size of
  651.      the data in use in that stack, in bytes.  */
  652. #ifdef YYLSP_NEEDED
  653.       /* This used to be a conditional around just the two extra args,
  654.      but that might be undefined if yyoverflow is a macro.  */
  655.       yyoverflow("parser stack overflow",
  656.          &yyss1, size * sizeof (*yyssp),
  657.          &yyvs1, size * sizeof (*yyvsp),
  658.          &yyls1, size * sizeof (*yylsp),
  659.          &yystacksize);
  660. #else
  661.       yyoverflow("parser stack overflow",
  662.          &yyss1, size * sizeof (*yyssp),
  663.          &yyvs1, size * sizeof (*yyvsp),
  664.          &yystacksize);
  665. #endif
  666.  
  667.       yyss = yyss1; yyvs = yyvs1;
  668. #ifdef YYLSP_NEEDED
  669.       yyls = yyls1;
  670. #endif
  671. #else /* no yyoverflow */
  672.       /* Extend the stack our own way.  */
  673.       if (yystacksize >= YYMAXDEPTH)
  674.     {
  675.       yyerror("parser stack overflow");
  676.       return 2;
  677.     }
  678.       yystacksize *= 2;
  679.       if (yystacksize > YYMAXDEPTH)
  680.     yystacksize = YYMAXDEPTH;
  681.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  682.       __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  683.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  684.       __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  685. #ifdef YYLSP_NEEDED
  686.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  687.       __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  688. #endif
  689. #endif /* no yyoverflow */
  690.  
  691.       yyssp = yyss + size - 1;
  692.       yyvsp = yyvs + size - 1;
  693. #ifdef YYLSP_NEEDED
  694.       yylsp = yyls + size - 1;
  695. #endif
  696.  
  697. #if YYDEBUG != 0
  698.       if (yydebug)
  699.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  700. #endif
  701.  
  702.       if (yyssp >= yyss + yystacksize - 1)
  703.     YYABORT;
  704.     }
  705.  
  706. #if YYDEBUG != 0
  707.   if (yydebug)
  708.     fprintf(stderr, "Entering state %d\n", yystate);
  709. #endif
  710.  
  711.   goto yybackup;
  712.  yybackup:
  713.  
  714. /* Do appropriate processing given the current state.  */
  715. /* Read a lookahead token if we need one and don't already have one.  */
  716. /* yyresume: */
  717.  
  718.   /* First try to decide what to do without reference to lookahead token.  */
  719.  
  720.   yyn = yypact[yystate];
  721.   if (yyn == YYFLAG)
  722.     goto yydefault;
  723.  
  724.   /* Not known => get a lookahead token if don't already have one.  */
  725.  
  726.   /* yychar is either YYEMPTY or YYEOF
  727.      or a valid token in external form.  */
  728.  
  729.   if (yychar == YYEMPTY)
  730.     {
  731. #if YYDEBUG != 0
  732.       if (yydebug)
  733.     fprintf(stderr, "Reading a token: ");
  734. #endif
  735.       yychar = YYLEX;
  736.     }
  737.  
  738.   /* Convert token to internal form (in yychar1) for indexing tables with */
  739.  
  740.   if (yychar <= 0)        /* This means end of input. */
  741.     {
  742.       yychar1 = 0;
  743.       yychar = YYEOF;        /* Don't call YYLEX any more */
  744.  
  745. #if YYDEBUG != 0
  746.       if (yydebug)
  747.     fprintf(stderr, "Now at end of input.\n");
  748. #endif
  749.     }
  750.   else
  751.     {
  752.       yychar1 = YYTRANSLATE(yychar);
  753.  
  754. #if YYDEBUG != 0
  755.       if (yydebug)
  756.     {
  757.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  758.       /* Give the individual parser a way to print the precise meaning
  759.          of a token, for further debugging info.  */
  760. #ifdef YYPRINT
  761.       YYPRINT (stderr, yychar, yylval);
  762. #endif
  763.       fprintf (stderr, ")\n");
  764.     }
  765. #endif
  766.     }
  767.  
  768.   yyn += yychar1;
  769.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  770.     goto yydefault;
  771.  
  772.   yyn = yytable[yyn];
  773.  
  774.   /* yyn is what to do for this token type in this state.
  775.      Negative => reduce, -yyn is rule number.
  776.      Positive => shift, yyn is new state.
  777.        New state is final state => don't bother to shift,
  778.        just return success.
  779.      0, or most negative number => error.  */
  780.  
  781.   if (yyn < 0)
  782.     {
  783.       if (yyn == YYFLAG)
  784.     goto yyerrlab;
  785.       yyn = -yyn;
  786.       goto yyreduce;
  787.     }
  788.   else if (yyn == 0)
  789.     goto yyerrlab;
  790.  
  791.   if (yyn == YYFINAL)
  792.     YYACCEPT;
  793.  
  794.   /* Shift the lookahead token.  */
  795.  
  796. #if YYDEBUG != 0
  797.   if (yydebug)
  798.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  799. #endif
  800.  
  801.   /* Discard the token being shifted unless it is eof.  */
  802.   if (yychar != YYEOF)
  803.     yychar = YYEMPTY;
  804.  
  805.   *++yyvsp = yylval;
  806. #ifdef YYLSP_NEEDED
  807.   *++yylsp = yylloc;
  808. #endif
  809.  
  810.   /* count tokens shifted since error; after three, turn off error status.  */
  811.   if (yyerrstatus) yyerrstatus--;
  812.  
  813.   yystate = yyn;
  814.   goto yynewstate;
  815.  
  816. /* Do the default action for the current state.  */
  817. yydefault:
  818.  
  819.   yyn = yydefact[yystate];
  820.   if (yyn == 0)
  821.     goto yyerrlab;
  822.  
  823. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  824. yyreduce:
  825.   yylen = yyr2[yyn];
  826.   if (yylen > 0)
  827.     yyval = yyvsp[1-yylen]; /* implement default value of the action */
  828.  
  829. #if YYDEBUG != 0
  830.   if (yydebug)
  831.     {
  832.       int i;
  833.  
  834.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  835.            yyn, yyrline[yyn]);
  836.  
  837.       /* Print the symbols being reduced, and their result.  */
  838.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  839.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  840.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  841.     }
  842. #endif
  843.  
  844.  
  845.   switch (yyn) {
  846.  
  847. case 4:
  848. #line 126 "./config/m68k-parse.y"
  849. {
  850.           op->mode = DREG;
  851.           op->reg = yyvsp[0].reg;
  852.         ;
  853.     break;}
  854. case 5:
  855. #line 131 "./config/m68k-parse.y"
  856. {
  857.           op->mode = AREG;
  858.           op->reg = yyvsp[0].reg;
  859.         ;
  860.     break;}
  861. case 6:
  862. #line 136 "./config/m68k-parse.y"
  863. {
  864.           op->mode = FPREG;
  865.           op->reg = yyvsp[0].reg;
  866.         ;
  867.     break;}
  868. case 7:
  869. #line 141 "./config/m68k-parse.y"
  870. {
  871.           op->mode = CONTROL;
  872.           op->reg = yyvsp[0].reg;
  873.         ;
  874.     break;}
  875. case 8:
  876. #line 146 "./config/m68k-parse.y"
  877. {
  878.           op->mode = CONTROL;
  879.           op->reg = yyvsp[0].reg;
  880.         ;
  881.     break;}
  882. case 9:
  883. #line 151 "./config/m68k-parse.y"
  884. {
  885.           op->mode = ABSL;
  886.           op->disp = yyvsp[0].exp;
  887.         ;
  888.     break;}
  889. case 10:
  890. #line 156 "./config/m68k-parse.y"
  891. {
  892.           op->mode = IMMED;
  893.           op->disp = yyvsp[0].exp;
  894.         ;
  895.     break;}
  896. case 11:
  897. #line 161 "./config/m68k-parse.y"
  898. {
  899.           op->mode = IMMED;
  900.           op->disp = yyvsp[0].exp;
  901.         ;
  902.     break;}
  903. case 12:
  904. #line 166 "./config/m68k-parse.y"
  905. {
  906.           op->mode = REGLST;
  907.           op->mask = yyvsp[0].mask;
  908.         ;
  909.     break;}
  910. case 13:
  911. #line 179 "./config/m68k-parse.y"
  912. {
  913.           op->mode = AINDR;
  914.           op->reg = yyvsp[-1].reg;
  915.         ;
  916.     break;}
  917. case 14:
  918. #line 184 "./config/m68k-parse.y"
  919. {
  920.           op->mode = AINC;
  921.           op->reg = yyvsp[-2].reg;
  922.         ;
  923.     break;}
  924. case 15:
  925. #line 189 "./config/m68k-parse.y"
  926. {
  927.           op->mode = ADEC;
  928.           op->reg = yyvsp[-1].reg;
  929.         ;
  930.     break;}
  931. case 16:
  932. #line 194 "./config/m68k-parse.y"
  933. {
  934.           op->reg = yyvsp[-1].reg;
  935.           op->disp = yyvsp[-3].exp;
  936.           if ((yyvsp[-1].reg >= ZADDR0 && yyvsp[-1].reg <= ZADDR7)
  937.               || yyvsp[-1].reg == ZPC)
  938.             op->mode = BASE;
  939.           else
  940.             op->mode = DISP;
  941.         ;
  942.     break;}
  943. case 17:
  944. #line 204 "./config/m68k-parse.y"
  945. {
  946.           op->reg = yyvsp[-3].reg;
  947.           op->disp = yyvsp[-1].exp;
  948.           if ((yyvsp[-3].reg >= ZADDR0 && yyvsp[-3].reg <= ZADDR7)
  949.               || yyvsp[-3].reg == ZPC)
  950.             op->mode = BASE;
  951.           else
  952.             op->mode = DISP;
  953.         ;
  954.     break;}
  955. case 18:
  956. #line 214 "./config/m68k-parse.y"
  957. {
  958.           op->reg = yyvsp[-1].reg;
  959.           op->disp = yyvsp[-3].exp;
  960.           if ((yyvsp[-1].reg >= ZADDR0 && yyvsp[-1].reg <= ZADDR7)
  961.               || yyvsp[-1].reg == ZPC)
  962.             op->mode = BASE;
  963.           else
  964.             op->mode = DISP;
  965.         ;
  966.     break;}
  967. case 19:
  968. #line 224 "./config/m68k-parse.y"
  969. {
  970.           op->mode = DISP;
  971.           op->reg = yyvsp[-1].reg;
  972.         ;
  973.     break;}
  974. case 20:
  975. #line 229 "./config/m68k-parse.y"
  976. {
  977.           op->mode = BASE;
  978.           op->reg = yyvsp[-1].reg;
  979.         ;
  980.     break;}
  981. case 21:
  982. #line 234 "./config/m68k-parse.y"
  983. {
  984.           op->mode = BASE;
  985.           op->reg = yyvsp[-1].reg;
  986.         ;
  987.     break;}
  988. case 22:
  989. #line 239 "./config/m68k-parse.y"
  990. {
  991.           op->mode = BASE;
  992.           op->reg = yyvsp[-3].reg;
  993.           op->disp = yyvsp[-5].exp;
  994.           op->index = yyvsp[-1].indexreg;
  995.         ;
  996.     break;}
  997. case 23:
  998. #line 246 "./config/m68k-parse.y"
  999. {
  1000.           if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC)
  1001.             yyerror ("syntax error");
  1002.           op->mode = BASE;
  1003.           op->reg = yyvsp[-1].reg;
  1004.           op->disp = yyvsp[-5].exp;
  1005.           op->index.reg = yyvsp[-3].reg;
  1006.           op->index.size = SIZE_UNSPEC;
  1007.           op->index.scale = 1;
  1008.         ;
  1009.     break;}
  1010. case 24:
  1011. #line 257 "./config/m68k-parse.y"
  1012. {
  1013.           op->mode = BASE;
  1014.           op->reg = yyvsp[-1].reg;
  1015.           op->disp = yyvsp[-4].exp;
  1016.           op->index = yyvsp[-2].indexreg;
  1017.         ;
  1018.     break;}
  1019. case 25:
  1020. #line 264 "./config/m68k-parse.y"
  1021. {
  1022.           op->mode = BASE;
  1023.           op->reg = yyvsp[-3].reg;
  1024.           op->disp = yyvsp[-5].exp;
  1025.           op->index = yyvsp[-1].indexreg;
  1026.         ;
  1027.     break;}
  1028. case 26:
  1029. #line 271 "./config/m68k-parse.y"
  1030. {
  1031.           op->mode = BASE;
  1032.           op->reg = yyvsp[-3].reg;
  1033.           op->index = yyvsp[-1].indexreg;
  1034.         ;
  1035.     break;}
  1036. case 27:
  1037. #line 277 "./config/m68k-parse.y"
  1038. {
  1039.           if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC)
  1040.             yyerror ("syntax error");
  1041.           op->mode = BASE;
  1042.           op->reg = yyvsp[-1].reg;
  1043.           op->disp = yyvsp[-5].exp;
  1044.           op->index.reg = yyvsp[-3].reg;
  1045.           op->index.size = SIZE_UNSPEC;
  1046.           op->index.scale = 1;
  1047.         ;
  1048.     break;}
  1049. case 28:
  1050. #line 288 "./config/m68k-parse.y"
  1051. {
  1052.           if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC)
  1053.             yyerror ("syntax error");
  1054.           op->mode = BASE;
  1055.           op->reg = yyvsp[-1].reg;
  1056.           op->index.reg = yyvsp[-3].reg;
  1057.           op->index.size = SIZE_UNSPEC;
  1058.           op->index.scale = 1;
  1059.         ;
  1060.     break;}
  1061. case 29:
  1062. #line 298 "./config/m68k-parse.y"
  1063. {
  1064.           op->mode = BASE;
  1065.           op->reg = yyvsp[-1].reg;
  1066.           op->disp = yyvsp[-4].exp;
  1067.           op->index = yyvsp[-2].indexreg;
  1068.         ;
  1069.     break;}
  1070. case 30:
  1071. #line 305 "./config/m68k-parse.y"
  1072. {
  1073.           op->mode = BASE;
  1074.           op->reg = yyvsp[-1].reg;
  1075.           op->index = yyvsp[-2].indexreg;
  1076.         ;
  1077.     break;}
  1078. case 31:
  1079. #line 311 "./config/m68k-parse.y"
  1080. {
  1081.           op->mode = POST;
  1082.           op->reg = yyvsp[-5].reg;
  1083.           op->disp = yyvsp[-6].exp;
  1084.           op->index = yyvsp[-2].indexreg;
  1085.           op->odisp = yyvsp[-1].exp;
  1086.         ;
  1087.     break;}
  1088. case 32:
  1089. #line 319 "./config/m68k-parse.y"
  1090. {
  1091.           op->mode = POST;
  1092.           op->reg = yyvsp[-3].reg;
  1093.           op->disp = yyvsp[-4].exp;
  1094.           op->odisp = yyvsp[-1].exp;
  1095.         ;
  1096.     break;}
  1097. case 33:
  1098. #line 326 "./config/m68k-parse.y"
  1099. {
  1100.           op->mode = POST;
  1101.           op->reg = yyvsp[-5].reg;
  1102.           op->index = yyvsp[-2].indexreg;
  1103.           op->odisp = yyvsp[-1].exp;
  1104.         ;
  1105.     break;}
  1106. case 34:
  1107. #line 333 "./config/m68k-parse.y"
  1108. {
  1109.           op->mode = POST;
  1110.           op->reg = yyvsp[-3].reg;
  1111.           op->odisp = yyvsp[-1].exp;
  1112.         ;
  1113.     break;}
  1114. case 35:
  1115. #line 339 "./config/m68k-parse.y"
  1116. {
  1117.           op->mode = PRE;
  1118.           op->reg = yyvsp[-5].reg;
  1119.           op->disp = yyvsp[-7].exp;
  1120.           op->index = yyvsp[-3].indexreg;
  1121.           op->odisp = yyvsp[-1].exp;
  1122.         ;
  1123.     break;}
  1124. case 36:
  1125. #line 347 "./config/m68k-parse.y"
  1126. {
  1127.           op->mode = PRE;
  1128.           op->reg = yyvsp[-5].reg;
  1129.           op->index = yyvsp[-3].indexreg;
  1130.           op->odisp = yyvsp[-1].exp;
  1131.         ;
  1132.     break;}
  1133. case 37:
  1134. #line 354 "./config/m68k-parse.y"
  1135. {
  1136.           if (yyvsp[-5].reg == PC || yyvsp[-5].reg == ZPC)
  1137.             yyerror ("syntax error");
  1138.           op->mode = PRE;
  1139.           op->reg = yyvsp[-3].reg;
  1140.           op->disp = yyvsp[-7].exp;
  1141.           op->index.reg = yyvsp[-5].reg;
  1142.           op->index.size = SIZE_UNSPEC;
  1143.           op->index.scale = 1;
  1144.           op->odisp = yyvsp[-1].exp;
  1145.         ;
  1146.     break;}
  1147. case 38:
  1148. #line 366 "./config/m68k-parse.y"
  1149. {
  1150.           if (yyvsp[-5].reg == PC || yyvsp[-5].reg == ZPC)
  1151.             yyerror ("syntax error");
  1152.           op->mode = PRE;
  1153.           op->reg = yyvsp[-3].reg;
  1154.           op->index.reg = yyvsp[-5].reg;
  1155.           op->index.size = SIZE_UNSPEC;
  1156.           op->index.scale = 1;
  1157.           op->odisp = yyvsp[-1].exp;
  1158.         ;
  1159.     break;}
  1160. case 39:
  1161. #line 377 "./config/m68k-parse.y"
  1162. {
  1163.           op->mode = PRE;
  1164.           op->reg = yyvsp[-3].reg;
  1165.           op->disp = yyvsp[-5].exp;
  1166.           op->index = yyvsp[-4].indexreg;
  1167.           op->odisp = yyvsp[-1].exp;
  1168.         ;
  1169.     break;}
  1170. case 40:
  1171. #line 390 "./config/m68k-parse.y"
  1172. {
  1173.           /* We use optzapc to avoid a shift/reduce conflict.  */
  1174.           if (yyvsp[-1].reg < ADDR0 || yyvsp[-1].reg > ADDR7)
  1175.             yyerror ("syntax error");
  1176.           op->mode = AINDR;
  1177.           op->reg = yyvsp[-1].reg;
  1178.         ;
  1179.     break;}
  1180. case 41:
  1181. #line 398 "./config/m68k-parse.y"
  1182. {
  1183.           /* We use optzapc to avoid a shift/reduce conflict.  */
  1184.           if (yyvsp[-2].reg < ADDR0 || yyvsp[-2].reg > ADDR7)
  1185.             yyerror ("syntax error");
  1186.           op->mode = AINC;
  1187.           op->reg = yyvsp[-2].reg;
  1188.         ;
  1189.     break;}
  1190. case 42:
  1191. #line 406 "./config/m68k-parse.y"
  1192. {
  1193.           /* We use optzapc to avoid a shift/reduce conflict.  */
  1194.           if (yyvsp[-2].reg < ADDR0 || yyvsp[-2].reg > ADDR7)
  1195.             yyerror ("syntax error");
  1196.           op->mode = ADEC;
  1197.           op->reg = yyvsp[-2].reg;
  1198.         ;
  1199.     break;}
  1200. case 43:
  1201. #line 414 "./config/m68k-parse.y"
  1202. {
  1203.           op->reg = yyvsp[-4].reg;
  1204.           op->disp = yyvsp[-1].exp;
  1205.           if ((yyvsp[-4].reg >= ZADDR0 && yyvsp[-4].reg <= ZADDR7)
  1206.               || yyvsp[-4].reg == ZPC)
  1207.             op->mode = BASE;
  1208.           else
  1209.             op->mode = DISP;
  1210.         ;
  1211.     break;}
  1212. case 44:
  1213. #line 424 "./config/m68k-parse.y"
  1214. {
  1215.           op->mode = BASE;
  1216.           op->reg = yyvsp[-5].reg;
  1217.           op->disp = yyvsp[-2].exp;
  1218.           op->index = yyvsp[-1].indexreg;
  1219.         ;
  1220.     break;}
  1221. case 45:
  1222. #line 431 "./config/m68k-parse.y"
  1223. {
  1224.           op->mode = POST;
  1225.           op->reg = yyvsp[-9].reg;
  1226.           op->disp = yyvsp[-6].exp;
  1227.           op->index = yyvsp[-1].indexreg;
  1228.           op->odisp = yyvsp[-2].exp;
  1229.         ;
  1230.     break;}
  1231. case 46:
  1232. #line 439 "./config/m68k-parse.y"
  1233. {
  1234.           op->mode = POST;
  1235.           op->reg = yyvsp[-8].reg;
  1236.           op->disp = yyvsp[-5].exp;
  1237.           op->odisp = yyvsp[-1].exp;
  1238.         ;
  1239.     break;}
  1240. case 47:
  1241. #line 446 "./config/m68k-parse.y"
  1242. {
  1243.           op->mode = PRE;
  1244.           op->reg = yyvsp[-9].reg;
  1245.           op->disp = yyvsp[-6].exp;
  1246.           op->index = yyvsp[-5].indexreg;
  1247.           op->odisp = yyvsp[-1].exp;
  1248.         ;
  1249.     break;}
  1250. case 49:
  1251. #line 461 "./config/m68k-parse.y"
  1252. {
  1253.           yyval.indexreg.reg = yyvsp[0].reg;
  1254.           yyval.indexreg.size = SIZE_UNSPEC;
  1255.           yyval.indexreg.scale = 1;
  1256.         ;
  1257.     break;}
  1258. case 51:
  1259. #line 475 "./config/m68k-parse.y"
  1260. {
  1261.           yyval.indexreg.reg = yyvsp[0].reg;
  1262.           yyval.indexreg.size = SIZE_UNSPEC;
  1263.           yyval.indexreg.scale = 1;
  1264.         ;
  1265.     break;}
  1266. case 62:
  1267. #line 518 "./config/m68k-parse.y"
  1268. {
  1269.           yyval.reg = ZADDR0;
  1270.         ;
  1271.     break;}
  1272. case 66:
  1273. #line 535 "./config/m68k-parse.y"
  1274. {
  1275.           yyval.reg = ZADDR0;
  1276.         ;
  1277.     break;}
  1278. case 67:
  1279. #line 539 "./config/m68k-parse.y"
  1280. {
  1281.           yyval.reg = yyvsp[0].reg;
  1282.         ;
  1283.     break;}
  1284. case 68:
  1285. #line 548 "./config/m68k-parse.y"
  1286. {
  1287.           yyval.exp.exp.X_op = O_absent;
  1288.           yyval.exp.size = SIZE_UNSPEC;
  1289.         ;
  1290.     break;}
  1291. case 69:
  1292. #line 553 "./config/m68k-parse.y"
  1293. {
  1294.           yyval.exp = yyvsp[0].exp;
  1295.         ;
  1296.     break;}
  1297. case 70:
  1298. #line 562 "./config/m68k-parse.y"
  1299. {
  1300.           yyval.exp.exp.X_op = O_absent;
  1301.           yyval.exp.size = SIZE_UNSPEC;
  1302.         ;
  1303.     break;}
  1304. case 71:
  1305. #line 567 "./config/m68k-parse.y"
  1306. {
  1307.           yyval.exp = yyvsp[-1].exp;
  1308.         ;
  1309.     break;}
  1310. case 73:
  1311. #line 577 "./config/m68k-parse.y"
  1312. {
  1313.           yyval.mask = yyvsp[-2].mask | yyvsp[0].mask;
  1314.         ;
  1315.     break;}
  1316. case 74:
  1317. #line 581 "./config/m68k-parse.y"
  1318. {
  1319.           yyval.mask = (1 << yyvsp[-2].onereg) | yyvsp[0].mask;
  1320.         ;
  1321.     break;}
  1322. case 75:
  1323. #line 593 "./config/m68k-parse.y"
  1324. {
  1325.           yyval.mask = 1 << yyvsp[0].onereg;
  1326.         ;
  1327.     break;}
  1328. case 77:
  1329. #line 598 "./config/m68k-parse.y"
  1330. {
  1331.           yyval.mask = yyvsp[-2].mask | yyvsp[0].mask;
  1332.         ;
  1333.     break;}
  1334. case 78:
  1335. #line 602 "./config/m68k-parse.y"
  1336. {
  1337.           yyval.mask = (1 << yyvsp[-2].onereg) | yyvsp[0].mask;
  1338.         ;
  1339.     break;}
  1340. case 79:
  1341. #line 609 "./config/m68k-parse.y"
  1342. {
  1343.           yyval.mask = (1 << (yyvsp[0].onereg + 1)) - 1 - ((1 << yyvsp[-2].onereg) - 1);
  1344.         ;
  1345.     break;}
  1346. case 80:
  1347. #line 616 "./config/m68k-parse.y"
  1348. {
  1349.           yyval.onereg = yyvsp[0].reg - DATA0;
  1350.         ;
  1351.     break;}
  1352. case 81:
  1353. #line 620 "./config/m68k-parse.y"
  1354. {
  1355.           yyval.onereg = yyvsp[0].reg - ADDR0 + 8;
  1356.         ;
  1357.     break;}
  1358. case 82:
  1359. #line 624 "./config/m68k-parse.y"
  1360. {
  1361.           yyval.onereg = yyvsp[0].reg - FP0 + 16;
  1362.         ;
  1363.     break;}
  1364. case 83:
  1365. #line 628 "./config/m68k-parse.y"
  1366. {
  1367.           if (yyvsp[0].reg == FPI)
  1368.             yyval.onereg = 24;
  1369.           else if (yyvsp[0].reg == FPS)
  1370.             yyval.onereg = 25;
  1371.           else
  1372.             yyval.onereg = 26;
  1373.         ;
  1374.     break;}
  1375. }
  1376.    /* the action file gets copied in in place of this dollarsign */
  1377. #line 487 "/usr/unsupported/share/bison.simple"
  1378.  
  1379.   yyvsp -= yylen;
  1380.   yyssp -= yylen;
  1381. #ifdef YYLSP_NEEDED
  1382.   yylsp -= yylen;
  1383. #endif
  1384.  
  1385. #if YYDEBUG != 0
  1386.   if (yydebug)
  1387.     {
  1388.       short *ssp1 = yyss - 1;
  1389.       fprintf (stderr, "state stack now");
  1390.       while (ssp1 != yyssp)
  1391.     fprintf (stderr, " %d", *++ssp1);
  1392.       fprintf (stderr, "\n");
  1393.     }
  1394. #endif
  1395.  
  1396.   *++yyvsp = yyval;
  1397.  
  1398. #ifdef YYLSP_NEEDED
  1399.   yylsp++;
  1400.   if (yylen == 0)
  1401.     {
  1402.       yylsp->first_line = yylloc.first_line;
  1403.       yylsp->first_column = yylloc.first_column;
  1404.       yylsp->last_line = (yylsp-1)->last_line;
  1405.       yylsp->last_column = (yylsp-1)->last_column;
  1406.       yylsp->text = 0;
  1407.     }
  1408.   else
  1409.     {
  1410.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1411.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1412.     }
  1413. #endif
  1414.  
  1415.   /* Now "shift" the result of the reduction.
  1416.      Determine what state that goes to,
  1417.      based on the state we popped back to
  1418.      and the rule number reduced by.  */
  1419.  
  1420.   yyn = yyr1[yyn];
  1421.  
  1422.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1423.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1424.     yystate = yytable[yystate];
  1425.   else
  1426.     yystate = yydefgoto[yyn - YYNTBASE];
  1427.  
  1428.   goto yynewstate;
  1429.  
  1430. yyerrlab:   /* here on detecting error */
  1431.  
  1432.   if (! yyerrstatus)
  1433.     /* If not already recovering from an error, report this error.  */
  1434.     {
  1435.       ++yynerrs;
  1436.  
  1437. #ifdef YYERROR_VERBOSE
  1438.       yyn = yypact[yystate];
  1439.  
  1440.       if (yyn > YYFLAG && yyn < YYLAST)
  1441.     {
  1442.       int size = 0;
  1443.       char *msg;
  1444.       int x, count;
  1445.  
  1446.       count = 0;
  1447.       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  1448.       for (x = (yyn < 0 ? -yyn : 0);
  1449.            x < (sizeof(yytname) / sizeof(char *)); x++)
  1450.         if (yycheck[x + yyn] == x)
  1451.           size += strlen(yytname[x]) + 15, count++;
  1452.       msg = (char *) malloc(size + 15);
  1453.       if (msg != 0)
  1454.         {
  1455.           strcpy(msg, "parse error");
  1456.  
  1457.           if (count < 5)
  1458.         {
  1459.           count = 0;
  1460.           for (x = (yyn < 0 ? -yyn : 0);
  1461.                x < (sizeof(yytname) / sizeof(char *)); x++)
  1462.             if (yycheck[x + yyn] == x)
  1463.               {
  1464.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1465.             strcat(msg, yytname[x]);
  1466.             strcat(msg, "'");
  1467.             count++;
  1468.               }
  1469.         }
  1470.           yyerror(msg);
  1471.           free(msg);
  1472.         }
  1473.       else
  1474.         yyerror ("parse error; also virtual memory exceeded");
  1475.     }
  1476.       else
  1477. #endif /* YYERROR_VERBOSE */
  1478.     yyerror("parse error");
  1479.     }
  1480.  
  1481.   goto yyerrlab1;
  1482. yyerrlab1:   /* here on error raised explicitly by an action */
  1483.  
  1484.   if (yyerrstatus == 3)
  1485.     {
  1486.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1487.  
  1488.       /* return failure if at end of input */
  1489.       if (yychar == YYEOF)
  1490.     YYABORT;
  1491.  
  1492. #if YYDEBUG != 0
  1493.       if (yydebug)
  1494.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1495. #endif
  1496.  
  1497.       yychar = YYEMPTY;
  1498.     }
  1499.  
  1500.   /* Else will try to reuse lookahead token
  1501.      after shifting the error token.  */
  1502.  
  1503.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1504.  
  1505.   goto yyerrhandle;
  1506.  
  1507. yyerrdefault:  /* current state does not do anything special for the error token. */
  1508.  
  1509. #if 0
  1510.   /* This is wrong; only states that explicitly want error tokens
  1511.      should shift them.  */
  1512.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1513.   if (yyn) goto yydefault;
  1514. #endif
  1515.  
  1516. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1517.  
  1518.   if (yyssp == yyss) YYABORT;
  1519.   yyvsp--;
  1520.   yystate = *--yyssp;
  1521. #ifdef YYLSP_NEEDED
  1522.   yylsp--;
  1523. #endif
  1524.  
  1525. #if YYDEBUG != 0
  1526.   if (yydebug)
  1527.     {
  1528.       short *ssp1 = yyss - 1;
  1529.       fprintf (stderr, "Error: state stack now");
  1530.       while (ssp1 != yyssp)
  1531.     fprintf (stderr, " %d", *++ssp1);
  1532.       fprintf (stderr, "\n");
  1533.     }
  1534. #endif
  1535.  
  1536. yyerrhandle:
  1537.  
  1538.   yyn = yypact[yystate];
  1539.   if (yyn == YYFLAG)
  1540.     goto yyerrdefault;
  1541.  
  1542.   yyn += YYTERROR;
  1543.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1544.     goto yyerrdefault;
  1545.  
  1546.   yyn = yytable[yyn];
  1547.   if (yyn < 0)
  1548.     {
  1549.       if (yyn == YYFLAG)
  1550.     goto yyerrpop;
  1551.       yyn = -yyn;
  1552.       goto yyreduce;
  1553.     }
  1554.   else if (yyn == 0)
  1555.     goto yyerrpop;
  1556.  
  1557.   if (yyn == YYFINAL)
  1558.     YYACCEPT;
  1559.  
  1560. #if YYDEBUG != 0
  1561.   if (yydebug)
  1562.     fprintf(stderr, "Shifting error token, ");
  1563. #endif
  1564.  
  1565.   *++yyvsp = yylval;
  1566. #ifdef YYLSP_NEEDED
  1567.   *++yylsp = yylloc;
  1568. #endif
  1569.  
  1570.   yystate = yyn;
  1571.   goto yynewstate;
  1572. }
  1573. #line 638 "./config/m68k-parse.y"
  1574.  
  1575.  
  1576. /* The string to parse is stored here, and modified by yylex.  */
  1577.  
  1578. static char *str;
  1579.  
  1580. /* The original string pointer.  */
  1581.  
  1582. static char *strorig;
  1583.  
  1584. /* If *CCP could be a register, return the register number and advance
  1585.    *CCP.  Otherwise don't change *CCP, and return 0.  */
  1586.  
  1587. static enum m68k_register
  1588. m68k_reg_parse (ccp)
  1589.      register char **ccp;
  1590. {
  1591.   char *start = *ccp;
  1592.   char c;
  1593.   char *p;
  1594.   symbolS *symbolp;
  1595.  
  1596.   if (flag_reg_prefix_optional)
  1597.     {
  1598.       if (*start == REGISTER_PREFIX)
  1599.     start++;
  1600.       p = start;
  1601.     }
  1602.   else
  1603.     {
  1604.       if (*start != REGISTER_PREFIX)
  1605.     return 0;
  1606.       p = start + 1;
  1607.     }
  1608.  
  1609.   if (! is_name_beginner (*p))
  1610.     return 0;
  1611.  
  1612.   p++;
  1613.   while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
  1614.     p++;
  1615.  
  1616.   c = *p;
  1617.   *p = 0;
  1618.   symbolp = symbol_find (start);
  1619.   *p = c;
  1620.  
  1621.   if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
  1622.     {
  1623.       *ccp = p;
  1624.       return S_GET_VALUE (symbolp);
  1625.     }
  1626.  
  1627.   /* In MRI mode, something like foo.bar can be equated to a register
  1628.      name.  */
  1629.   while (flag_mri && c == '.')
  1630.     {
  1631.       ++p;
  1632.       while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
  1633.     p++;
  1634.       c = *p;
  1635.       *p = '\0';
  1636.       symbolp = symbol_find (start);
  1637.       *p = c;
  1638.       if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
  1639.     {
  1640.       *ccp = p;
  1641.       return S_GET_VALUE (symbolp);
  1642.     }
  1643.     }
  1644.  
  1645.   return 0;
  1646. }
  1647.  
  1648. /* The lexer.  */
  1649.  
  1650. static int
  1651. yylex ()
  1652. {
  1653.   enum m68k_register reg;
  1654.   char *s;
  1655.   int parens;
  1656.   int c = 0;
  1657.   int tail = 0;
  1658.   char *hold;
  1659.  
  1660.   if (*str == ' ')
  1661.     ++str;
  1662.  
  1663.   if (*str == '\0')
  1664.     return 0;
  1665.  
  1666.   /* Various special characters are just returned directly.  */
  1667.   switch (*str)
  1668.     {
  1669.     case '@':
  1670.       /* In MRI mode, this can be the start of an octal number.  */
  1671.       if (flag_mri)
  1672.     {
  1673.       if (isdigit (str[1])
  1674.           || ((str[1] == '+' || str[1] == '-')
  1675.           && isdigit (str[2])))
  1676.         break;
  1677.     }
  1678.       /* Fall through.  */
  1679.     case '#':
  1680.     case '&':
  1681.     case ',':
  1682.     case ')':
  1683.     case '/':
  1684.     case '[':
  1685.     case ']':
  1686.       return *str++;
  1687.     case '+':
  1688.       /* It so happens that a '+' can only appear at the end of an
  1689.          operand.  If it appears anywhere else, it must be a unary
  1690.          plus on an expression.  */
  1691.       if (str[1] == '\0')
  1692.     return *str++;
  1693.       break;
  1694.     case '-':
  1695.       /* A '-' can only appear in -(ar), rn-rn, or ar@-.  If it
  1696.          appears anywhere else, it must be a unary minus on an
  1697.          expression.  */
  1698.       if (str[1] == '\0')
  1699.     return *str++;
  1700.       s = str + 1;
  1701.       if (*s == '(')
  1702.     ++s;
  1703.       if (m68k_reg_parse (&s) != 0)
  1704.     return *str++;
  1705.       break;
  1706.     case '(':
  1707.       /* A '(' can only appear in `(reg)', `(expr,...', `([', `@(', or
  1708.          `)('.  If it appears anywhere else, it must be starting an
  1709.          expression.  */
  1710.       if (str[1] == '['
  1711.       || (str > strorig
  1712.           && (str[-1] == '@'
  1713.           || str[-1] == ')')))
  1714.     return *str++;
  1715.       s = str + 1;
  1716.       if (m68k_reg_parse (&s) != 0)
  1717.     return *str++;
  1718.       /* Check for the case of '(expr,...' by scanning ahead.  If we
  1719.          find a comma outside of balanced parentheses, we return '('.
  1720.          If we find an unbalanced right parenthesis, then presumably
  1721.          the '(' really starts an expression.  */
  1722.       parens = 0;
  1723.       for (s = str + 1; *s != '\0'; s++)
  1724.     {
  1725.       if (*s == '(')
  1726.         ++parens;
  1727.       else if (*s == ')')
  1728.         {
  1729.           if (parens == 0)
  1730.         break;
  1731.           --parens;
  1732.         }
  1733.       else if (*s == ',' && parens == 0)
  1734.         {
  1735.           /* A comma can not normally appear in an expression, so
  1736.          this is a case of '(expr,...'.  */
  1737.           return *str++;
  1738.         }
  1739.     }
  1740.     }
  1741.  
  1742.   /* See if it's a register.  */
  1743.  
  1744.   reg = m68k_reg_parse (&str);
  1745.   if (reg != 0)
  1746.     {
  1747.       int ret;
  1748.  
  1749.       yylval.reg = reg;
  1750.  
  1751.       if (reg >= DATA0 && reg <= DATA7)
  1752.     ret = DR;
  1753.       else if (reg >= ADDR0 && reg <= ADDR7)
  1754.     ret = AR;
  1755.       else if (reg >= FP0 && reg <= FP7)
  1756.     return FPR;
  1757.       else if (reg == FPI
  1758.            || reg == FPS
  1759.            || reg == FPC)
  1760.     return FPCR;
  1761.       else if (reg == PC)
  1762.     return LPC;
  1763.       else if (reg >= ZDATA0 && reg <= ZDATA7)
  1764.     ret = ZDR;
  1765.       else if (reg >= ZADDR0 && reg <= ZADDR7)
  1766.     ret = ZAR;
  1767.       else if (reg == ZPC)
  1768.     return LZPC;
  1769.       else
  1770.     return CREG;
  1771.  
  1772.       /* If we get here, we have a data or address register.  We
  1773.      must check for a size or scale; if we find one, we must
  1774.      return INDEXREG.  */
  1775.  
  1776.       s = str;
  1777.  
  1778.       if (*s != '.' && *s != ':' && *s != '*')
  1779.     return ret;
  1780.  
  1781.       yylval.indexreg.reg = reg;
  1782.  
  1783.       if (*s != '.' && *s != ':')
  1784.     yylval.indexreg.size = SIZE_UNSPEC;
  1785.       else
  1786.     {
  1787.       ++s;
  1788.       switch (*s)
  1789.         {
  1790.         case 'w':
  1791.         case 'W':
  1792.           yylval.indexreg.size = SIZE_WORD;
  1793.           ++s;
  1794.           break;
  1795.         case 'l':
  1796.         case 'L':
  1797.           yylval.indexreg.size = SIZE_LONG;
  1798.           ++s;
  1799.           break;
  1800.         default:
  1801.           yyerror ("illegal size specification");
  1802.           yylval.indexreg.size = SIZE_UNSPEC;
  1803.           break;
  1804.         }
  1805.     }
  1806.  
  1807.       if (*s != '*' && *s != ':')
  1808.     yylval.indexreg.scale = 1;
  1809.       else
  1810.     {
  1811.       ++s;
  1812.       switch (*s)
  1813.         {
  1814.         case '1':
  1815.         case '2':
  1816.         case '4':
  1817.         case '8':
  1818.           yylval.indexreg.scale = *s - '0';
  1819.           ++s;
  1820.           break;
  1821.         default:
  1822.           yyerror ("illegal scale specification");
  1823.           yylval.indexreg.scale = 1;
  1824.           break;
  1825.         }
  1826.     }
  1827.  
  1828.       str = s;
  1829.  
  1830.       return INDEXREG;
  1831.     }
  1832.  
  1833.   /* It must be an expression.  Before we call expression, we need to
  1834.      look ahead to see if there is a size specification.  We must do
  1835.      that first, because otherwise foo.l will be treated as the symbol
  1836.      foo.l, rather than as the symbol foo with a long size
  1837.      specification.  The grammar requires that all expressions end at
  1838.      the end of the operand, or with ',', '(', ']', ')'.  */
  1839.  
  1840.   parens = 0;
  1841.   for (s = str; *s != '\0'; s++)
  1842.     {
  1843.       if (*s == '(')
  1844.     {
  1845.       if (parens == 0
  1846.           && s > str
  1847.           && (s[-1] == ')' || isalnum ((unsigned char) s[-1])))
  1848.         break;
  1849.       ++parens;
  1850.     }
  1851.       else if (*s == ')')
  1852.     {
  1853.       if (parens == 0)
  1854.         break;
  1855.       --parens;
  1856.     }
  1857.       else if (parens == 0
  1858.            && (*s == ',' || *s == ']'))
  1859.     break;
  1860.     }
  1861.  
  1862.   yylval.exp.size = SIZE_UNSPEC;
  1863.   if (s <= str + 2
  1864.       || (s[-2] != '.' && s[-2] != ':'))
  1865.     tail = 0;
  1866.   else
  1867.     {
  1868.       switch (s[-1])
  1869.     {
  1870.     case 's':
  1871.     case 'S':
  1872.     case 'b':
  1873.     case 'B':
  1874.       yylval.exp.size = SIZE_BYTE;
  1875.       break;
  1876.     case 'w':
  1877.     case 'W':
  1878.       yylval.exp.size = SIZE_WORD;
  1879.       break;
  1880.     case 'l':
  1881.     case 'L':
  1882.       yylval.exp.size = SIZE_LONG;
  1883.       break;
  1884.     default:
  1885.       break;
  1886.     }
  1887.       if (yylval.exp.size != SIZE_UNSPEC)
  1888.     tail = 2;
  1889.     }
  1890.  
  1891. #ifdef OBJ_ELF
  1892.   {
  1893.     /* Look for @PLTPC, etc.  */
  1894.     char *cp;
  1895.  
  1896.     yylval.exp.pic_reloc = pic_none;
  1897.     cp = s - tail;
  1898.     if (cp - 6 > str && cp[-6] == '@')
  1899.       {
  1900.     if (strncmp (cp - 6, "@PLTPC", 6) == 0)
  1901.       {
  1902.         yylval.exp.pic_reloc = pic_plt_pcrel;
  1903.         tail += 6;
  1904.       }
  1905.     else if (strncmp (cp - 6, "@GOTPC", 6) == 0)
  1906.       {
  1907.         yylval.exp.pic_reloc = pic_got_pcrel;
  1908.         tail += 6;
  1909.       }
  1910.       }
  1911.     else if (cp - 4 > str && cp[-4] == '@')
  1912.       {
  1913.     if (strncmp (cp - 4, "@PLT", 4) == 0)
  1914.       {
  1915.         yylval.exp.pic_reloc = pic_plt_off;
  1916.         tail += 4;
  1917.       }
  1918.     else if (strncmp (cp - 4, "@GOT", 4) == 0)
  1919.       {
  1920.         yylval.exp.pic_reloc = pic_got_off;
  1921.         tail += 4;
  1922.       }
  1923.       }
  1924.   }
  1925. #endif
  1926.  
  1927.   if (tail != 0)
  1928.     {
  1929.       c = s[-tail];
  1930.       s[-tail] = 0;
  1931.     }
  1932.  
  1933.   hold = input_line_pointer;
  1934.   input_line_pointer = str;
  1935.   expression (&yylval.exp.exp);
  1936.   str = input_line_pointer;
  1937.   input_line_pointer = hold;
  1938.  
  1939.   if (tail != 0)
  1940.     {
  1941.       s[-tail] = c;
  1942.       str = s;
  1943.     }
  1944.  
  1945.   return EXPR;
  1946. }
  1947.  
  1948. /* Parse an m68k operand.  This is the only function which is called
  1949.    from outside this file.  */
  1950.  
  1951. int
  1952. m68k_ip_op (s, oparg)
  1953.      char *s;
  1954.      struct m68k_op *oparg;
  1955. {
  1956.   memset (oparg, 0, sizeof *oparg);
  1957.   oparg->error = NULL;
  1958.   oparg->index.reg = ZDATA0;
  1959.   oparg->index.scale = 1;
  1960.   oparg->disp.exp.X_op = O_absent;
  1961.   oparg->odisp.exp.X_op = O_absent;
  1962.  
  1963.   str = strorig = s;
  1964.   op = oparg;
  1965.  
  1966.   return yyparse ();
  1967. }
  1968.  
  1969. /* The error handler.  */
  1970.  
  1971. static void
  1972. yyerror (s)
  1973.      const char *s;
  1974. {
  1975.   op->error = s;
  1976. }
  1977.